﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using DG.Tweening;
/// <summary>
/// 死亡界面的字段和点击属性
/// </summary>
public class DeathManage : MonoBehaviour {
    private int score;//获取分数并处理分数
    private int checkpoint;//记录关卡
    #region 设置字段，获取组件
    [SerializeField, Tooltip("返回按钮")]
    private Button ret;
    [SerializeField, Tooltip("重新开始按钮")]
    private Button restart;
    [SerializeField, Tooltip("显示得分")]
    private Text scoreText;
    [SerializeField, Tooltip("动画框")]
    private Image frame;
    #endregion
    // Use this for initialization
    void Start () {
        frame = GameObject.Find("DeathPanel/CueTextFrame").GetComponent<Image>();
        frame.DOFade(0, 1f).SetLoops(-1, LoopType.Restart);
        checkpoint = SceneManager.GetActiveScene().buildIndex;
        #region 获取组件并添加事件
        ret = GameObject.Find("DeathPanel/Return").GetComponent<Button>();
        ret.onClick.AddListener(PropManager.Instance.ReturnCp);
        restart = GameObject.Find("DeathPanel/Restart").GetComponent<Button>();
        restart.onClick.AddListener(PropManager.Instance.Restart);
        
        #endregion
    }
}
